import { PrismaClient } from '@prisma/client'

const prisma = new PrismaClient()

async function main() {
  const user = await prisma.user.update({
    where: { id: 2 },
    data: { name: 'John Doe' ,posts:{
        updateMany: {
            where:{authorId:1},
            data:{title:"New Title"}
        }
    }},

  })
  console.log(user)
}

main()
  .then(async () => {
    await prisma.$disconnect()
  })
  .catch(async (e) => {
    console.error(e)
    await prisma.$disconnect()
    process.exit(1)
  })